﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImapX.Parsing.Tokens;
using System.Text.RegularExpressions;

namespace ImapX.Parsing.DataItems
{
    abstract public class DataItem : Token
    {
        abstract public string Command { get; }

        internal DataItem(bool canBeNIL = false) : base(canBeNIL) { }

        protected override string BeginPattern
        {
            get
            {
                if (parts.Length == 0) throw new Exception("If no parts are specified, the BasePattern property must be overridden.");

                return Regex.Escape(Command) + SP;
            }
        }
    }
}
